package com.yanqu.road.entity.activity.recallplayer.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.config.system.PropertyWeightItem;
import com.yanqu.road.entity.util.PropertyWeightItemHelper;
import com.yanqu.road.utils.property.PropertyHelper;

import java.util.List;
import java.util.Map;
import java.util.Objects;

public class RecallPlayerConfig {
    //银币
    private int activeSliverCoin;
    //金币
    private int activeGoldCoin;
    //需求等级
    private int needTitle;
    //需求开服天数
    private int needOpenServerDay;
    //可邀请掌柜上限
    private int recallPlayerMaxNum;
    //邀请码奖励 数值说下个版本改
    //private Map<Integer, List<PropertyWeightItem>> writeCodeReward;、
    private String writeCodeReward;
    //抽奖配置
    private Map<Integer, RecallPlayerDrawConfig> drawConfig;
    //回归配置
    private List<RecallPlayerTypeConfig> recallPlayerTypeConfigList;
    //每日到达的活跃度(任务用)
    private int dayAchieveActive;
    //分享奖励元宝
    private int shareIngots;

    public int getActiveSliverCoin() {
        return activeSliverCoin;
    }

    public int getActiveGoldCoin() {
        return activeGoldCoin;
    }

    public int getNeedTitle() {
        return needTitle;
    }

    public int getNeedOpenServerDay() {
        return needOpenServerDay;
    }



    public Map<Integer, RecallPlayerDrawConfig> getDrawConfig() {
        return drawConfig;
    }

    public void setDrawConfig(Map<Integer, RecallPlayerDrawConfig> drawConfig) {
        this.drawConfig = drawConfig;
    }

    public String getWriteCodeReward() {
        return writeCodeReward;
    }

    public void setWriteCodeReward(String writeCodeReward) {
        this.writeCodeReward = writeCodeReward;
    }

    public List<RecallPlayerTypeConfig> getRecallPlayerTypeConfigList() {
        return recallPlayerTypeConfigList;
    }

    public void setRecallPlayerTypeConfigList(List<RecallPlayerTypeConfig> recallPlayerTypeConfigList) {
        this.recallPlayerTypeConfigList = recallPlayerTypeConfigList;
    }

    public int getDayAchieveActive() {
        return dayAchieveActive;
    }

    public void setDayAchieveActive(int dayAchieveActive) {
        this.dayAchieveActive = dayAchieveActive;
    }

    public RecallPlayerConfig(Map<String, ActivityConfig> configMap) {
        for (Map.Entry<String, ActivityConfig> configEntry : configMap.entrySet()) {
            if (Objects.equals("EXCHANGE_SCORE_ITEM_ID_SILVER", configEntry.getKey())) {
                activeSliverCoin = configEntry.getValue().getIntValue();
            } else if (Objects.equals("EXCHANGE_SCORE_ITEM_ID_GOLD", configEntry.getKey())) {
                activeGoldCoin = configEntry.getValue().getIntValue();
            } else if (Objects.equals("RECALL_PLAYER_PERSON_OPEN_LIMIT", configEntry.getKey())) {
                List<Integer> stringListValue = configEntry.getValue().getIntListValue("\\|");
                needTitle = stringListValue.get(0);
                needOpenServerDay = stringListValue.get(1);
            } else if (Objects.equals("RECALL_PLAYER_AWARD_TRUE", configEntry.getKey())) {
                writeCodeReward = configEntry.getValue().getValue();
            } else if (Objects.equals("RECALL_PLAYER_FIRST_SHARE", configEntry.getKey())) {
                shareIngots = configEntry.getValue().getIntValue();
            } else if (Objects.equals("RECALL_PLAYER_MAX_NUM", configEntry.getKey())) {
                recallPlayerMaxNum = configEntry.getValue().getIntValue();
            }
        }
    }

    public RecallPlayerTypeConfig getRecallPlayerTypeConfigByType(int type) {
        for (RecallPlayerTypeConfig config : recallPlayerTypeConfigList) {
            if (config.getId() == type) {
                return config;
            }
        }
        return null;
    }

    public int getShareIngots() {
        return shareIngots;
    }

    public int getRecallPlayerMaxNum() {
        return recallPlayerMaxNum;
    }
}
